package com.ruiysoft.service.mdse.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruiysoft.entity.mdse.MerchandisePictureSpu;
import com.ruiysoft.mapper.mdse.MerchandisePictureSpuMapper;
import com.ruiysoft.service.mdse.IMerchandisePictureSpuService;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * <p>
 * 商品spu图片表 服务实现类
 * </p>
 *
 * @author liyahui
 * @since 2018-10-27
 */
@Service
public class MerchandisePictureSpuServiceImpl extends ServiceImpl<MerchandisePictureSpuMapper, MerchandisePictureSpu> implements IMerchandisePictureSpuService {

    @Override
    public MerchandisePictureSpu findMdsePicOneBySpuId(Long spuId) {
        return getOne(new QueryWrapper<MerchandisePictureSpu>().eq("spu_id", spuId).eq("type", 1).eq("del_flag", 0).orderBy(false, false, "sort"));
    }

    @Override
    public List<MerchandisePictureSpu> findMdsePicListBySpuId(Long spuId) {
        return list(new QueryWrapper<MerchandisePictureSpu>().eq("spu_id", spuId).eq("del_flag", 0).orderBy(false, false, "sort"));
    }
}
